#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int n = 0;
    int arr[10001];
    scanf("%d %d", &n, &arr[0]);
    int max = arr[0];
    int min = arr[0];
    for (int i = 1; i < n; i++)
    {
        scanf("%d", &arr[i]);
        if (max < arr[i])
        {
            max = arr[i];
        }
        if (min > arr[i])
        {
            min = arr[i];
        }
    }
    printf("%d", (max - min));
    return 0;
}